#pragma once

#include <assert.h>
#include "Types.h"

template < class T , u32 size >
class Array
{
public:
	Array() {};
	~Array(void) {};

	T& Get(u32 index);
	void Set(u32 index, T value);
	u32 Size() const;
	u32 MaxIndex() const;
	T* GetPtr() const;

	
	T& operator [] (size_t i);

	bool operator == (Array<T, size>& a) const;
	bool operator != (Array<T, size>& a) const;

private:
	T array[size];
};

template<class T, u32 size> 
inline T& Array<T, size>::Get(u32 index)
{
	assert(index >= 0 && index < size);
	return array[index];	
}

template<class T, u32 size> 
inline void Array<T, size>::Set(u32 index, T value)
{
	assert(index >= 0 && index < size);
	array[index] = value;
}

template<class T, u32 size> 
inline u32 Array<T, size>::Size() const
{
	return size;
}

template<class T, u32 size> 
inline T* Array<T, size>::GetPtr() const
{
	return array;
}

template<class T, u32 size> 
inline T& Array<T, size>::operator[] (size_t i)
{
	return Get(i);
}

template<class T, u32 size> 
inline u32 Array<T, size>::MaxIndex() const
{
	return size - 1;
}

template<class T, u32 size> 
inline bool Array<T, size>::operator== (Array<T, size>& ar) const
{
	for(int i = 0; i < size; i++)
	{
		if(array[i] != ar[i])
			return false;
	}

	return true;
}

template<class T, u32 size> 
inline bool Array<T, size>::operator!= (Array<T, size>& a) const
{
	for(int i = 0; i < size; i++)
	{
		if(array[i] != a[i])
			return true;
	}

	return false;
}
